package com.jugheadzhou.kafka.producer.controller;

import com.jugheadzhou.kafka.producer.dto.PatientBaseDto;
import com.jugheadzhou.kafka.producer.service.PatientBaseService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author jugheadzhou
 * @date 2021-09-22
 */
@RequestMapping("test")
@RestController
public class PatientBaseController {

    @Resource
    private PatientBaseService patientBaseService;

    /**
     * 保存患者信息
     *
     * @param dto
     * @return
     */
    @PostMapping("save")
    public ResponseEntity<?> savePatientBase(@RequestBody @Valid PatientBaseDto dto) {
        patientBaseService.save(dto);
        return ResponseEntity.ok("保存患者信息: " + dto);
    }


}
